FROM node:10.24.1

WORKDIR /usr/app/repchain-block-courier

ARG DOCKER_VERSION=20.10.9
ARG DOCKER_COMPOSE_VERSION=1.29.2
ARG http_proxy

RUN apt-get update \
    && apt-get install -y git python2.7 openjdk-8-jdk g++ make \
    && apt-get clean \
    && http_proxy=${http_proxy} curl -fsSLO https://download.docker.com/linux/static/stable/x86_64/docker-${DOCKER_VERSION}.tgz \
	&& tar zxf docker-${DOCKER_VERSION}.tgz --strip 1 -C /usr/local/bin docker/docker \
	&& rm docker-${DOCKER_VERSION}.tgz \
	&& http_proxy=${http_proxy} curl -L "https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose \
	&& chmod +x /usr/local/bin/docker-compose

COPY package.json ./
COPY yarn.lock ./

RUN yarn install 

COPY . .

CMD yarn deploy && cd database && npx prisma1 generate && yarn start
